# -- coding: utf-8 --
import re

# # 开始位置
# r = re.match('w+','www.tingfeng.com')
# print(r.group())
# print(r.span())
#
# # 任意位置
# z = re.search('o+','www.tingfeng.com')
# print(z.group())
# print(z.span())
#
#
# #　匹配首部
# b = re.search('^a','aab')
# print(b)
# n = re.search('^a','cabb')
# print(n)
#
# # 匹配尾部
# t = re.search('a$','cccbaa')
# print(t)
# u = re.search('a$','cabb')
# print(u)
#
# # 匹配一行数字
# qw = re.search('\d','dafds12325rdfadf')
# print(qw)
# we = re.search('\d{3}','dafds12325rdfadf')
# print(we)
#
# def isId(id):
#     parattm = '^[a-zA-Z][a-zA-Z0-9]*$'
#     obj = re.search(parattm,id)
#     if obj is None:
#         print("no %s" % (id))
#     else:
#         print("yes %s" % (id))
#
# isId('asdaf12')


# a = re.split('[ :]','www tingfeng:com')
# print(a)

# line = 'asdf14edeefdfaasf3423'
# o = re.sub('\d+','nmb',line)
# print(o)
# o = re.sub('#.*$', '', line)
# print(o)


def expian(url):
    patterm = '(.*)://(.*)/(.*)'
    obj = re.search(patterm,url)

    all = obj.group(0)
    xieyi = obj.group(1)
    host = obj.group(2)
    path = obj.group(3)

    print(xieyi)
    print(host)
    print(path)

expian('https://www.tingfeng.com/123')
